// SimpleTriangle.cpp : Defines the entry point for the application.
//

#include "SimpleTriangle/stdafx.h"
#include "SimpleTriangle/SimpleTriangle.h"

#include <crtdbg.h>

// #include <config/BaseConfig.h>
// #include <config/ConfigManager.h>
#include <core/exception.h>
#include <core/pair.h>
#include <core/vector.h>

#include <mem/mem_profile.h>

#include "SimpleTriangle/SimpleTriangleApp.h"

#include <iostream>
#include <core/RBTree.h>

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       /*nCmdShow*/)
{
	UNREFERENCED_PARAMETER(hInstance);
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	_CrtSetDbgFlag( _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF );

	tt::SimpleTriangleApp app;

	try
	{
		app.run();

		MEM_SERIALIZE("memory_before_exit.txt");

//		config::g_cfgMgr().close();
	}
	catch (tt::core::Exception& ex)
	{
		MessageBox(NULL, ex.msg().c_str(), TEXT("Exception"), MB_OK | MB_ICONEXCLAMATION);
	}

	return 0;
}